<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆界面</title>
</head>
<body>

<div align="center" style="background-color: antiquewhite;">
    <form action="./2017-08-15.html" id="f1">
    <table>
        <tr>
            <td align="right">用户名：</td>
            <td><input type="text" id="user" value=""></td>
        </tr>
        <tr>
            <td align="right">密码：</td>
            <td ><input type="text" id="password" value=""></td>
        </tr>
    </table>

    <input type="button" id="submit" value="登陆" onclick="sub()"><br/>
    <a href="homework2.html">没有账号，前往注册</a>
    </form>
</div>
<script type="text/javascript">
    function sub() {
        var user= document.getElementById("user").value;
        if(user.length==0||user.length>20){
            alert("请输入正确的帐号");
            return;
        }else if(document.getElementById("password").value.length==0){
            alert("两次输入密码不同");
            return;
        }
        else document.getElementById("f1").submit();
    }
</script>

</body>
</html>